﻿@model List<Senparc.Weixin.Sample.TenPayV3.Models.ProductModel>
@*DPBMARK_FILE TenPay*@
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>产品列表（微信支付 V3）</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
            line-height: 1.6;
            padding: 20px;
            max-width: 1200px;
            margin: 0 auto;
            background-color: #f5f5f5;
        }

        .container {
            padding: 15px;
        }

        .page-title {
            color: #333;
            margin-bottom: 20px;
            text-align: center;
        }

        .notice {
            background-color: #fff3cd;
            border: 1px solid #ffeeba;
            color: #856404;
            padding: 12px;
            border-radius: 4px;
            margin-bottom: 20px;
        }

        .encryption-info {
            background-color: #e9ecef;
            padding: 10px;
            border-radius: 4px;
            margin-bottom: 20px;
            font-size: 0.9em;
        }

        #productList {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
            list-style: none;
            padding: 0;
        }

        #productList li {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }

        #productList li:hover {
            transform: translateY(-5px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        }

        #productList li a {
            text-decoration: none;
            color: #333;
            padding: 20px;
            display: block;
        }

        #productList h2 {
            font-size: 1.2em;
            margin-bottom: 10px;
            color: #2c3e50;
        }

        .price {
            color: #e74c3c;
            font-size: 1.1em;
            font-weight: bold;
            margin: 10px 0;
        }

        .buy-button {
            background-color: #2ecc71;
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            text-align: center;
            margin-top: 10px;
            transition: background-color 0.2s ease;
        }

        .buy-button:hover {
            background-color: #27ae60;
        }

        @@media (max-width: 768px) {
            body {
                padding: 10px;
            }

            #productList {
                grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
                gap: 15px;
            }

            #productList li a {
                padding: 15px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1 class="page-title">微信支付 V3 产品列表</h1>
        
        @if (Senparc.Weixin.BrowserUtility.BrowserUtility.SideInWeixinBrowser(this.Context))
        {
            <div class="notice">提示：此网页在微信外部浏览器中打开可以体验"扫一扫支付"和"H5"支付</div>
        }
        else
        {
            <div class="notice">提示：此页面在微信浏览器内打开可以体验微信JS-SDK微信支付</div>
        }
        
        <div class="encryption-info">当前支付使用加密方式：@Senparc.Weixin.Config.SenparcWeixinSetting.TenpayV3Setting.EncryptionType</div>

        <ul id="productList">
            @for (int i = 0; i <= Model.Count - 1; i++)
            {
                var item = Model[i];
                <li>
                    <a href="@Url.Action("ProductItem", "TenPayApiV3", new {productId = item.Id, hc = item.GetHashCode()})">
                        <h2>@item.Name</h2>
                        <p class="price">@item.Price.ToString("c")</p>
                        <div class="buy-button">立即购买</div>
                    </a>
                </li>
            }
        </ul>
    </div>
</body>
</html>
